@extends('admin.home.main')

@section('body')
<section id="main-content">

<section class="wrapper">
<h3>测试题库管理-项目选项列表</h3>
<hr>

<!-- row -->
<div class="row mt">
  <div class="col-md-12">
    <div class="content-panel">
      <table class="table table-striped table-advance table-hover">
        <thead>
          <tr>
          	<th>#</th>
            <th>选项名称</th>
            <th>添加时间</th>
            <th>操作 | <a href="/admin/item_bank/anadd/{{$id}}">添加选项</a> | <a href="/admin/item_bank/list">返回</a></th>
          </tr>
        </thead>
        <tbody>
          @foreach($alist as $atm=>$ast)
            <tr>
              <td>{{$ast->id}}</td>
              <td>{{$ast->option}}</td>
              <td>{{$ast->add_date}}</td>
              <td>
                <a href="/admin/item_bank/a_modify/{{$ast->id}}" class="btn btn-primary btn-xs">编辑</a>
                <button type="button" class="btn btn-danger btn-xs col_del" colid="{{$ast->id}}">删除</button>  
              </td>
            </tr>
          @endforeach
        </tbody>
      </table>
    </div>
    <!-- /content-panel -->
  </div>
  <!-- /col-md-12 -->
</div>
<!-- /row -->
</section>
</section>
<script type="text/javascript">
  $('.col_del').click(function(){
    var _colId = $(this).attr('colid');
    var a = confirm('请确认是否要删除该选项');
    var t = $(this).parent().parent();

    if(a == true){
      $.ajax({
        'type':'get',
        'url':'/admin/item_bank/a_del/'+_colId,
        'dataType':'json',
        success:function(msg){
          if(msg.code == 200){
            alert('删除成功');
          }else{
            alert('删除失败');
          }
          location.reload();
        }
      })
    }
  })
</script>
@endsection